<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        textarea{width:400px;height:500px;}
    </style>
</head>
<body>
    <textarea id="txt1"></textarea>
    <input type="button" id="btn" value="转换">
    <textarea id="txt2"></textarea>
</body>
<script>

    var txt1 = document.getElementById("txt1")
    var txt2 = document.getElementById("txt2")
    var btn = document.getElementById("btn")

    // 贪婪特性：尽可能的多匹配
    btn.onclick = function(){

        var reg = /<[^>]+>/g;

        txt2.value = txt1.value.replace(reg, "")

    }
    
</script>
</html>